package leetcode.greedy;

import java.util.Arrays;
import java.util.Comparator;

public class dictionary {
    public static class MyComparator implements Comparator<String> {

        @Override
        public int compare(String o1, String o2) {
            return (o1+o2).compareTo(o2+o1);
        }
    }

    public static String lowestString(String[] strings){
        if (strings == null || strings.length == 0){
            return "";
        }
        Arrays.sort(strings,new MyComparator());
        String string = null;
        for (int i = 0; i <strings.length ; i++) {
            string = string+strings[i];
        }
        return string;
    }
}
